package gold.contest;

import java.util.*;
import java.util.List;

/**
 * Created by fanzhenyu02 on 2020/6/27.
 * common problem solver template.
 */
public class LC5713 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int numDifferentIntegers(String word) {
            String[] numArray = word.split("\\D");
            Set<String> numSet = new HashSet<>();
            for (String numStr : numArray) {
                if (numStr.length() > 0) {
                    int i = 0;
                    for (; i < numStr.length(); i++) {
                        if (numStr.charAt(i) == '0') continue;
                        else {
                            numSet.add(numStr.substring(i, numStr.length()));
                            break;
                        }
                    }
                    if (i == numStr.length()) numSet.add("0");
                }
            }

            return numSet.size();
        }
    }

    public void run() {
        Solution solution = new Solution();
        System.out.println(solution.numDifferentIntegers("a123bc34d8ef34"));
    }

    public static void main(String[] args) throws Exception {
        LC5713 an = new LC5713();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
